<?php

namespace App\Http\Service;

use App\Models\Reporttypeconfig;
use App\Models\Doubanpost;
use App\Models\Baoliaopost;
use App\Http\Service\UserService;
use App\Http\Service\BaseService;
use App\Http\Service\CommentService;
use Illuminate\Support\Facades\DB;
#举报类型列表
class ReporttypeconfigService  extends BaseService
{
    private $model;

    public function __construct(Reporttypeconfig $model,Doubanpost  $doubanpost,UserService $userService,Baoliaopost $baoliaopost,CommentService $commentService)
    {
        parent::__construct();
        $this->model = $model;
        $this->doubanpost=$doubanpost;
        $this->userService=$userService;
        $this->baoliaopost=$baoliaopost;
        $this->commentService=$commentService;
       
    }
    //评论区举报评论区类型-列表
    public function commentreportconfiglist($request,$data=[])
    {
        $where=[];
        $where=[
            'is_enabled'=>'1',
        ];
        $fields = ['id','type_code','type_name','description'];
        $list = $this->model->select($fields)
            ->where($where)
            ->get()->toArray();
       
        return $list; 
        



    }

    #评论区列表- 重新组装
    public function reportconfiglist($request,$data=[])
    {
        $reportconfiglist=$this->commentreportconfiglist($request);
        $result=[];
        foreach ($reportconfiglist as $k => $value) {
            $key="{$value['type_code']}";
            $result[$key]=$value;
        }
        return $result;
    }
    
}
